package com.example.mapper;

import com.example.dto.AdminPageDto;
import com.example.entity.Admin;
import com.example.vo.AdminVo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface AdminMapper {


    Page<Admin> findByNameWithUname(AdminPageDto adminPageDto);

    @Select("select * from admin where uname=#{uname} and upassword=#{upassword} limit 1")
    Admin findByNameAndPassword(Admin admin);

    @Select("select *from admin where uname = #{uname} limit 1")
    Admin findByUname(Admin admin);

    void add(Admin admin);
    @Delete("delete from admin where id = #{id}")
    void deleteById(Integer id);

    void update(Admin admin);
    @Select("select * from admin where id = #{id}")
    Admin getById(Integer id);
}
